////
/// @group password
////

@use "sass:map";
@use "../utils";
@use "../spacing";
@use "../button/button";
@use "base";
@use "text-field";

/// Set to `true` to disable the `Password` styles
/// @type Boolean
$disable-everything: text-field.$disable-everything !default;

/// The `padding-left` to apply to a `Password` when there is a visibility
/// icon.
/// @type Number
$visibility-toggle-spacing: spacing.get-var(xs) !default;

/// Generates all the styles based on feature flags.
///
/// @param {Boolean} disable-layer [false] - Set this to `true` to disable the
/// layer behavior
@mixin styles($disable-layer: false) {
  @if not $disable-everything {
    @include utils.optional-layer(password, $disable-layer) {
      .rmd-password {
        @include text-field.set-var(padding-right, $visibility-toggle-spacing);

        &__input {
          @include button.use-var(margin-right, icon-size);

          @include utils.rtl {
            @include button.use-var(margin-left, icon-size);

            margin-right: 0;
          }
        }

        &__toggle {
          position: absolute;
          right: 0;

          @include utils.rtl {
            left: 0;
            right: auto;
          }
        }
      }
    }
  }
}
